<?php
class Control_Gm_getItemByType {
	function getItemByType() {
		$itemType = MooForm::request('itemType');
		$gm_awardsinfo = MooConfig::get('gm_awardsinfo.giftIds');
		if($gm_awardsinfo) {
			$gmInfos = array();	
			foreach ($gm_awardsinfo as $key => $val) {
				if($val['type'] == $itemType) {
					$gmInfos[] = $val;
				}
			}

			exit(MooJson::encode($gmInfos));
			
		} else {
			exit(null);
		}
	}
}